package com.paddyi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.paddyi.commons.http.HttpResult;
import com.paddyi.model.Stock;
import com.paddyi.service.IStockService;

/**
 *  (Stock)
 * @author paddy
 * @since  2019-08-09 12:00:53
 */
@RestController
@RequestMapping("stock")
public class StockController{

	@Autowired
	private IStockService stockService;

	/**
	 * 下单减库存
	 * @param record
	 * @return
	 */	
	@PostMapping(value="/place")
	public HttpResult place(@RequestBody Stock record) {
		return HttpResult.ok(stockService.place(record));
	}

    /**
     * 查询
     * @return
     */
	@PostMapping(value="/findAll")
	public HttpResult findAll() {
		return HttpResult.ok(stockService.findAll());
	}


}
